<template>
  <footer class="footer">
    <span class="todo-count" >剩余<strong>数量值{{list1.length}}</strong></span>
    <ul class="filters">
      <li>
        <a :class="gal === 'all' ? 'selected' : ''" href="javascript:;" @click="allFn">全部</a>
      </li>
      <li>
        <a :class="gal === 'no' ? 'selected' : ''" href="javascript:;" @click="remainFn">未完成</a>
      </li>
      <li>
        <a :class="gal === 'yes' ? 'selected' : ''" href="javascript:;" @click="finishFn">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="fulfillFn">清除已完成</button>
  </footer>
</template>

<script>
export default {
  data() {
    return {}
  },
  computed: {
    list1() {
      return this.$store.state.getList.list1
    },
    gal() {
      return this.$store.state.getList.gal
    }
  },
  methods: {
    allFn() {
      this.$store.state.getList.list1 = this.$store.state.getList.list
      this.$store.state.getList.gal = 'all'
    },
    remainFn() {
      this.$store.commit('getList/remainList')
    },
    finishFn() {
      this.$store.commit('getList/finishList')
    },
    fulfillFn() {
      this.$store.commit('getList/fulfillList')
    }
  }
}
</script>
